<?php

/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2016/9/18
 * Time: 16:48
 */

namespace Admin\Service;

use Admin\Model\LoginModel;

class UserService
{
    public function checkUserLogin($data){
        $loginMdl = new LoginModel();

        if(!$loginMdl->create($data)) {
            throw new \LogicException($loginMdl->getError());
        } else {
            $ret = $loginMdl->where($data)->find();
            unset($ret['password']);
            session('admin_login_info',$ret);

            if($ret) {
                return true;
            }
            return false;
        }
    }


}